export default {
    get session() {
        return localStorage.getItem('Authorization')
    },

    headers(data) {//无请求体
        return {
            AccessId: 'achance',
            reqtime: Date.now(),
            version: '1.0.0',
            sign: CryptoJS.MD5(data).toString(),
            reqlength:  new TextEncoder('utf-8').encode(data).length,
            Authorization: this.session
        }
    },

    headersBody(data) {//请求体
        const str = JSON.stringify(data)
        return {
            AccessId: 'achance',
            reqtime: Date.now(),
            version: '1.0.0',
            sign: CryptoJS.MD5(JSON.stringify(data)).toString(),
            reqlength: str.length,
            Authorization: this.session,
        }
    }
}